package com.shelpe.services.sinbad.dto.common;

import java.util.List;

import lombok.Data;

@Data
public class ListMybatisPage<T> {

	private List<T> content;
	private int size;
	private int totalPages;
	private int totalElements;
	private int number;
	private int numberOfElements;

	public void from(int page, int size, int sum, int contentSize) {
		this.size = size;
		this.totalPages = (sum % size == 0 ? sum / size : (int) Math.floor(sum / size) + 1);
		this.totalElements = sum;
		this.number = page + 1;
		this.numberOfElements = contentSize;
	}
}
